{% extends 'base.html' %}
{% block content %}
    <div class="col-md-8 col-md-offset-2">
        <table class="table table-bordered">
            <div><a href="/add/" class="btn btn-primary">添加人员</a></div>
            <thead>
            <tr>
                <th>序号</th>
                <th>用户id值</th>
                <th>用户名</th>
                <th>手机号</th>
                <th>性别</th>
                <th>用户的角色名称</th>
            </tr>
            </thead>
            <tbody>
            {% for foo in userinfo %}
                <tr>
                    <td>{{ forloop.counter }}</td>
                    <td>{{ foo.id }}</td>
                    <td>{{ foo.username }}</td>
                    <td>{{ foo.phone }}</td>
                    <td>{{ foo.userdetails.sex }}</td>
                    <td>
                        {% for f in foo.roles.all %}
                            {{ f.name }}
                            {% if forloop.last %}
                            {% else %}
                                ,
                            {% endif %}
                        {% endfor %}
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
{% endblock %}